@import (reference) 'config';
@import (reference) 'icons';
@import (reference) '../../../app/less/typography';

.help-icon {
  display: inline-block;

  &__icon {
    margin-left: 7px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    width: 14px;
    height: 14px;
    font-style: normal;
    background: @color-accent-100 @dex-info-icon center no-repeat;
    transition: background 0.3s;

    &:after {
      display: none;
      width: 10px;
      height: 10px;
      background: @color-submit-300;
      transform: rotate(-45deg);
      left: 2px;
      top: 19px;
      position: absolute;
      content: '';
      z-index: 1;
    }

    &.hovered,
    &:hover {
      background-color: @color-submit-300;
    }

    &.hovered::after,
    &:hover::after {
      display: block;
    }

    &.hovered + .help-icon__content,
    &:hover + .help-icon__content {
      display: block;
    }
  }

  &__content {
    display: none;
    z-index: 19;
    position: absolute;
    color: @color-basic-700;
    background: @color-white;
    border-top: 5px solid @color-submit-300;
    border-radius: @border-radius;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.18);
    padding: 15px;
    margin-top: 24px;
    left: 40px;
    width: calc(100% ~'- 80px');

    .label-background {
      background: @label-background-color;
      display: inline-block;
      padding: 3px 5px;
      border-radius: @border-radius / 2;
      margin: 0 4px 2px 0;
    }

    &:hover {
      display: block;
    }
  }

  &__row {
    margin-bottom: 5px;
    margin-top: 0;
  }
}

w-help-icon {
  display: inline-flex;
  z-index: 10;
  flex-shrink: 0;

  &.info {
    .help-icon {
      &__icon {
        background-image: @dex-help-icon;
      }
    }
  }
}

md-dialog {
  .help-icon {
    &__content {
      left: 80px;
      width: calc(100% ~'- 160px');
    }
  }
}

@media screen and (max-width: 540px) {
  .help-icon {
    &__content {
      left: 20px;
      width: calc(100% ~'- 40px');
    }
  }

  md-dialog {
    .help-icon {
      &__content {
        left: 40px;
        width: calc(100% ~'- 80px');
      }
    }
  }
}
